<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class FeedbackRequest extends FormRequest
{
    /**
     * Determine if the blacklist is authorized to make this request.
     *
     * @return bool
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules(): array
    {
        return [
            'title' => 'required|string|min:2|max:200',
            'content' => 'required|between:10,1000'
        ];
    }

    public function messages(): array
    {
        return [
            'title.required' => '请输入标题',
            'title.string' => '标题格式错误',
            'title.min' => '标题至少输入2个字符',
            'title.max' => '标题字符不能大于200',
            'content.between' => '内容长度只能在10~1000之间'
        ];
    }
}
